var express = require('express');
var router = express.Router();

/* GET home page. */
// router.get('/', function(req, res, next) {
//   res.render('index', { title: 'Express' });
// });

const { getComplaints,getComplaintsById,minusLessorsCredits,handleComplaints,minusTenantsCredits } = require('../service/complaintsService')
router.get('/getComplaints',async function(req,res,next){
    const data = await getComplaints(req.query)
    res.send(data)
});

router.post('/getComplaintsById',async function(req,res,next){
    const data = await getComplaintsById(req.body)
    res.send(data)
})

router.post("/minusLessorsCredits",async function (req,res,next){
    const data = await minusLessorsCredits(req.body)
    res.send(data)
})

router.post("/minusTenantsCredits",async function (req,res,next){
    const data = await minusTenantsCredits(req.body)
    res.send(data)
})

router.post("/handleComplaints",async function(req,res,next){
    const data = await handleComplaints(req.body)
    res.send(data)
})

module.exports = router;